package com.egao.orderB.controller;

import com.egao.common.core.annotation.ApiPageParam;
import com.egao.common.core.damon.results.PageResult2;
import com.egao.common.core.web.*;
import com.egao.common.core.annotation.OperLog;
import com.egao.orderB.entity.OceanPreConfiguration;
import com.egao.orderB.service.OceanPreConfigurationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.ui.Model;


/**
 *
 * 预配
 * @author : Doman
 * @date : 2021-10-20 16:59:51
 * @version ：1.0
 */

@Api(tags = "预配")
@RestController
@RequestMapping("/api/orderB/oceanPreConfiguration")
public class OceanPreConfigurationController extends BaseController {

	@Autowired
	private OceanPreConfigurationService oceanPreConfigurationService;

	/**
	 * 分页查询列表
	 */
	@PreAuthorize("hasAuthority('orderB:oceanPreConfiguration:list')")
  @ApiOperation(value ="分页查询预配",notes = "" +
    "limit:每页显示几行 必填\n" +
    "page:第几页 必填\n" +
    " \n\n\n" +
    "返回的结果:\n" +
    "id:id\n" +
    "bookingAgentId:订舱代理id\n" +
    "bookingAgent:订舱代理\n" +
    "ship:船公司\n" +
          "vessel:船名\n" +
          "voyage:航次\n" +
          "airRoute:航线\n" +
          "goShipDay:开船日\n" +
          "entrustmentAnnex:托书文件\n" +
          "cusPlanDeposit:客户计划押金\n" +
          "cusPlanDepositPath:客户计划押金路径 对公，对私，蔡总\n" +
          "preStorageDeposit:预存仓位押金\n" +
          "preStorageDepositPath:预存仓位押金路径 对公，对私，蔡总\n" +
    "customerId:客户id\n" +
    "customer:客户\n" +
    "boxType:箱型\n" +
    "cusPlanPrice:客户计划金额\n" +
    "preStoragePrice:预存仓位金额\n" +
    "preDate:预配时间\n" +
    "createTime:创建时间\n" +
    "createUser:创建人\n" +
    "updateTime:更新时间\n" +
    "updateUser:更新人\n" +
    "",httpMethod = "POST")
  @ApiPageParam
  @PostMapping("/list")
  public JsonResult page(PageResult2<T> page, OceanPreConfiguration oceanPreConfiguration) throws Exception{
    return oceanPreConfigurationService.list(page, oceanPreConfiguration, getLoginUser());
  }

  /**
   * 查询全部预配
   */
  @PreAuthorize("hasAuthority('orderB:oceanPreConfiguration:list')")
  @ApiOperation("查询全部预配")
  @PostMapping("/listAll")
  public JsonResult list(OceanPreConfiguration oceanPreConfiguration){
    return oceanPreConfigurationService.list(oceanPreConfiguration, getLoginUser());
  }

  /**
   * 根据id查询预配
   */
  @PreAuthorize("hasAuthority('orderB:oceanPreConfiguration:list')")
  @ApiOperation("根据id查询预配")
  @PostMapping("/get")
  public JsonResult get(OceanPreConfiguration oceanPreConfiguration) {
    return oceanPreConfigurationService.getById(oceanPreConfiguration);
  }


  /**
   * 添加预配
   */
  @PreAuthorize("hasAuthority('orderB:oceanPreConfiguration:save')")
  @OperLog(value = "预配", desc = "添加", param = false, result = true)
  @ApiOperation(value ="添加预配",notes = "" +
    "oceanPreStoragePositionId:预存仓位id\n" +
    "oceanCustomerPlanId:客户计划id\n" +
    "bookingAgentId:订舱代理id\n" +
    "bookingAgent:订舱代理\n" +
    "ship:船公司\n" +
          "vessel:船名\n" +
          "voyage:航次\n" +
          "airRoute:航线\n" +
          "goShipDay:开船日\n" +
          "entrustmentAnnex:托书文件\n" +
          "cusPlanDeposit:客户计划押金\n" +
          "cusPlanDepositPath:客户计划押金路径 对公，对私，蔡总\n" +
          "preStorageDeposit:预存仓位押金\n" +
          "preStorageDepositPath:预存仓位押金路径 对公，对私，蔡总\n" +
    "customerId:客户id\n" +
    "customer:客户\n" +
    "boxType:箱型\n" +
          "cusPlanPrice:客户计划金额\n" +
          "preStoragePrice:预存仓位金额\n" +
    "preDate:预配时间\n" +
    "",httpMethod = "POST")
  @PostMapping("/save")
  public JsonResult save(Model model, OceanPreConfiguration oceanPreConfiguration) {
    return oceanPreConfigurationService.save(oceanPreConfiguration, getLoginUser());
  }

  /**
   * 修改预配
   */
  @PreAuthorize("hasAuthority('orderB:oceanPreConfiguration:update')")
  @OperLog(value = "预配", desc = "修改", param = false, result = true)
  @ApiOperation(value ="修改预配",notes = "" +
    "id:id\n" +
    "bookingAgentId:订舱代理id\n" +
    "bookingAgent:订舱代理\n" +
    "ship:船公司\n" +"vessel:船名\n" +
          "voyage:航次\n" +
          "airRoute:航线\n" +
          "goShipDay:开船日\n" +
          "entrustmentAnnex:托书文件\n" +
          "cusPlanDeposit:客户计划押金\n" +
          "cusPlanDepositPath:客户计划押金路径 对公，对私，蔡总\n" +
          "preStorageDeposit:预存仓位押金\n" +
          "preStorageDepositPath:预存仓位押金路径 对公，对私，蔡总\n" +
    "customerId:客户id\n" +
    "customer:客户\n" +
    "boxType:箱型\n" +
          "cusPlanPrice:客户计划金额\n" +
          "preStoragePrice:预存仓位金额\n" +
    "preDate:预配时间\n" +
    "",httpMethod = "POST")
  @PostMapping("/update")
  public JsonResult update(Model model, OceanPreConfiguration oceanPreConfiguration) {
    return oceanPreConfigurationService.update(oceanPreConfiguration, getLoginUser());
  }

  /**
   * 删除预配
   */
  @PreAuthorize("hasAuthority('orderB:oceanPreConfiguration:remove')")
  @OperLog(value = "预配", desc = "删除", result = true)
  @ApiOperation(value ="删除预配",notes = "" +
          "id:id\n" +
          "",httpMethod = "POST")
  @PostMapping("/remove")
  public JsonResult remove(OceanPreConfiguration oceanPreConfiguration ) {
    return oceanPreConfigurationService.remove(oceanPreConfiguration, getLoginUser());
  }

}
